/*
 * @Author: guoyangf
 * @Date: 2020-06-12 11:02:24
 * @LastEditTime: 2020-08-28 15:58:39
 * @Description: 查询区和表格区显示状态控制
 */
import React, { Component } from 'react';
import './index.less';
import { base, } from 'nc-lightapp-front'; 
const { NCTooltip, } = base;
class SearchTableStatusCtrl extends Component {
    constructor(props) {
        super();
        this.state = {
            searchIconIsDefaultStatus: true,
            tableIconIsDefaultStatus: true,
            multiLang: {}
        }

        this.multiLangPromise = window.__SSC_MultiLangPromise;
        if (this.multiLangPromise) {
            this.multiLangPromise.then((multiLang) => {
                this.setState({
                    multiLang
                })
            })
        }
    }

    render() {
        const multiLang = this.props.comMultiLang || this.state.multiLang;
        return (
            <div className="search_table_status_ctrl">
                <NCTooltip
                    placement='top'
                    inverse
                    overlay={this.state.searchIconIsDefaultStatus ? multiLang['job-icon-tips-sq'] : multiLang['job-icon-tips-zk']}
                    trigger={[`hover`, `focus`, ]}
                >
                    <i
                        className={`menu-type-icon iconfont ${this.state.searchIconIsDefaultStatus ? 'icon-xiangshang1' : 'icon-Artboardfuben'} nc-theme-btn-secondary`} onClick={
                        () => {
                            this.props.setIsFold && this.props.setIsFold();
                            this.setState({
                                searchIconIsDefaultStatus: !this.state.searchIconIsDefaultStatus
                            })
                        }
                    }></i>
                </NCTooltip>
                
                {
                    this.props.iconBtnEvent && this.props.iconBtnEvent.showCard ?
                        (
                            <NCTooltip
                                placement='top'
                                inverse
                                overlay={this.state.tableIconIsDefaultStatus ? multiLang['job-icon-tips-kpxs'] : multiLang['job-icon-tips-lbxs']}
                                trigger={[`hover`, `focus`, ]}
                            >
                                <i
                                    className={`menu-type-icon iconfont ${this.state.tableIconIsDefaultStatus ? 'icon-Group' : 'icon-shituqiehuan'} nc-theme-btn-secondary`}
                                    onClick={() => {
                                        this.props.iconBtnEvent.showCard();
                                        this.setState({
                                            tableIconIsDefaultStatus: !this.state.tableIconIsDefaultStatus
                                        })
                                    }}
                                ></i>
                            </NCTooltip>
                        )
                        :
                        null
                }

            </div>
        )
    }
}

export default SearchTableStatusCtrl;